//
//  WebViewJavascripBridge+Extension.swift
//  MeenoHybrid
//
//  Created by alyadan on 2016/10/16.
//  Copyright © 2016年 alyadan. All rights reserved.
//

import Foundation
import UIKit

//MARK: Hybrid_EmptyHandler
/*
public protocol Hybrid_EmptyHandler {
    func callHandler(data:Any)
}

extension WebViewJavascriptBridge: Hybrid_EmptyHandler {
    public func callHandler(data: Any) {
        callHandler(HybridHandlerCenter.H5MainHandler, data: data)
    }
}

extension WKWebViewJavascriptBridge: Hybrid_EmptyHandler {
    public func callHandler(data: Any) {
        callHandler(HybridHandlerCenter.H5MainHandler, data: data)
    }
}

 */

//捕捉异常信息

//extension wkUIDelegate {
//    //HTML页面Alert出内容
//    func webView(webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
//        let ac = UIAlertController(title: webView.title, message: message, preferredStyle: UIAlertControllerStyle.alert)
//        ac.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.cancel, handler: { (a) -> Void in
//            completionHandler()
//        }))
//        
//        self.present(ac, animated: true, completion: nil)
//    }
//    
//    //HTML页面弹出Confirm时调用此方法
//    func webView(webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) {
//        let ac = UIAlertController(title: webView.title, message: message, preferredStyle: UIAlertControllerStyle.alert)
//        ac.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler:
//            { (ac) -> Void in
//                completionHandler(true)  //按确定的时候传true
//        }))
//        
//        ac.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler:
//            { (ac) -> Void in
//                completionHandler(false)  //取消传false
//        }))
//        
//        self.present(ac, animated: true, completion: nil)
//    }
//}

